<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="客户价格查询" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<link href="/css/Query.css" rel="stylesheet" type="text/css">
<script src="/js/QueryList.js"></script>
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doPriceNew(estId){
		var url="/base/EstPriceNew.ihtm?type=${type}&est_id="+estId;
		ShowIframeNoScroll("客户价格",url,900,400,"refreshWin()");
	}
	function refreshWin(){
		if(popRetVal!=null){
			window.location.reload(true);
		}
	}
	function doSearch(){
		var searchKey=encodeURIComponent(document.getElementById("search_key").value.trim());
		var typeId="";
		if(document.getElementById("type_id")!==null){
			typeId=document.getElementById("type_id").value;
		}
		var levelId="";
		if(document.getElementById("level_id")!=null){
			levelId=document.getElementById("level_id").value;
		}
		var areaId=document.getElementById("area_id").value;
		var tsId="";
		if(document.getElementById("ts_id")!=null){
			tsId=document.getElementById("ts_id").value;
		}
		window.location="/base/EstablishmentListForPrice.ihtm?type=${type}&type_id="+typeId+"&level_id="+levelId+"&area_id="+areaId+"&ts_id="+tsId+"&search_key="+searchKey;
	}
	function doGo(pageIndex){
		var searchKey=encodeURIComponent("${searchKey}");
		var typeId="${typeId}";
		var levelId="${levelId}";
		var areaId="${areaId}";
		var tsId="${tsId}";
		window.location="/base/EstablishmentListForPrice.ihtm?type=${type}&type_id="+typeId+"&level_id="+levelId+"&area_id="+areaId+"&ts_id="+tsId+"&search_key="+searchKey+"&current_page="+pageIndex;
	}
	function doJump(pageIndex){
		if(window.event.keyCode==13){
			doGo(pageIndex);
		}
	}
	function doCancel(){
		window.close();
	}
	function DoubleClick(it){
		var ob_arr = document.getElementsByName("query_checkbox");
		var estId="";
		if(ob_arr.length>=it.getAttribute("index")){
			estId=ob_arr[it.getAttribute("index")-1].value;
		}
		if(estId!=""){
			doPriceList(estId);
		}
	}
	function doInit(){
		Window_Onload();
		document.getElementById("search_key").focus();
	}
	function checkSearchKey(){
		if(window.event.keyCode==13){
			doSearch();
		}
	}
	function doPriceList(estId){
		showWin(1024,600,"/base/EstPriceList.ihtm?type=${type}&est_id="+estId);
	}
</script>
</head>
<body oncontextmenu="return false" onload="doInit();" class="sheet" style="text-align:center;">
<div class="sheet-main" style="width:860px;text-align:left;margin:auto;">
  <div class="sheet-top">
    <div class="content">
      <h2>客户价格查询</h2>
      <p>查询客户预先定义的价格</p>
    </div>
  </div>
  <div class="sheet-list">
    <div class="search-business">
      <div class="content">
        <table width="748">
          <tbody>
            <tr>
              <td  align="right">
		            <input type="text" class="TextBox" id="search_key" name="search_key" onKeyUp="checkSearchKey();" style="width:100px" value="${searchKey}" title="以名称、拼音字头进行模糊查询">
					<select id="type_id" name='type_id'>
						<option value="0">==全部类别==</option>
						<c:forEach var="item" items="${estTypeList}">
						<option value="${item.id}" <c:if test="${typeId==item.id}">selected</c:if>>${item.typeName}</option>
						</c:forEach>
		  			</select>
		  			<select id='level_id' name='level_id'>
						<option value="0">==全部等级==</option>
						<c:forEach var="item" items="${estLevelList}">
						<option value="${item.id}" <c:if test="${levelId==item.id}">selected</c:if>>${item.levelName}</option>
						</c:forEach>
		  			</select>
		  			<select id='area_id' name='area_id'>
						<option value="0">==全部地区==</option>
						<c:forEach var="item" items="${areaList}">
						<option value="${item.id}" <c:if test="${areaId==item.id}">selected</c:if>>${item.areaName}</option>
						</c:forEach>
		  			</select>
		  			<c:if test="${checkTs=='Y'}">
		  			<select id='ts_id' name='ts_id'>
						<option value="0">==全部账套==</option>
						<c:forEach var="item" items="${tsList}">
						<option value="${item.id}" <c:if test="${tsId==item.id}">selected</c:if>>${item.title}</option>
						</c:forEach>
		  			</select>
		  			</c:if>
					<input type="button" class="buttom search-but" value=" 查 询" onClick="doSearch();" title="以名称、拼音字头进行模糊查询">
			</td>
            </tr>    
           </tbody>      
        </table>
      </div>
	  <%@include file="../inc/AlertMsg.jsp"%>
      <div class="table-list">
        <table width="100%">      
			<tr >
				<th width="14"></th>
				<th width="200">编号</th>
				<th width="430">名称</th>
				<th width="160">经办人</th>
				<th width="140">操作</th>
			</tr>
			<c:forEach var="item" items="${qr.list}" varStatus="i">
				<c:if test="${(i.index mod 2)==0}"><c:set var="trClass" value="query_list_data_tr1" /></c:if>
				<c:if test="${(i.index mod 2)!=0}"><c:set var="trClass" value="query_list_data_tr2" /></c:if>
				<tr class="${trClass}" index="${i.index+1}" style='cursor:pointer;' ondblclick='javascript:DoubleClick(this)' onClick='javascript:ClickCheck(this)' onmouseout='javascript:mouseout(this)' onmouseover='javascript:mouseover(this)'>
					<td><input type="radio" name='query_checkbox' value="${item.establishment.id}"></td>
					<td>${item.establishment.estCode}</td>
					<td>${item.establishment.estName}</td>
					<td>${item.establishment.managerName}</td>
					<td>
						<a href="javascript:doPriceList('${item.establishment.id}');">查价格</a>
						<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';CLIE_PRIC;')!=-1}"><a href="javascript:doPriceNew('${item.establishment.id}');">新增价格</a></c:if>
					</td>
				</tr>
			</c:forEach>
		</table>
		<%@include file="../inc/Pages.jsp"%>
      </div>
    </div>
  </div>
</div>
</body>
</html>